home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Utilities / MView / gxu / gxu.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-30  |  3.7 KB  |  137 lines

  1. #pragma once
  2.  
  3. #ifndef __GXU_H
  4. #define __GXU_H
  5.  
  6. #ifndef WIN_TYPES
  7. #define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype
  8. #endif
  9. interface IDirectXFileData;
  10. WIN_TYPES(IDirectXFileData,             DIRECTXFILEDATA);
  11.  
  12. /*//////////////////////////////////////////////////////////////////////////////
  13. //
  14. // File: gxu.h
  15. //
  16. // Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  17. //
  18. // Description:
  19. //    This header file is used to turn on asserts and tracing even in release
  20. //  mode.
  21. //
  22. //
  23. //////////////////////////////////////////////////////////////////////////////*/
  24. #include "d3dx8dbg.h"
  25.  
  26. #if 0
  27. // templates generate names > 255 chars in debug info
  28. // 4786: identifier was truncated to 'number' characters in the debug information
  29. #pragma warning(disable : 4786)
  30.  
  31. #if defined(DBG) || defined(DEBUG) || defined (_DEBUG)
  32.     #ifndef _DEBUG
  33.         #define _DEBUG
  34.     #endif
  35.     #ifndef DBG
  36.         #define DBG 1
  37.     #endif
  38. #endif
  39.  
  40. #if defined(WIN32) || defined(_WIN32)
  41.     #ifndef WIN32
  42.         #define WIN32
  43.     #endif
  44.     #ifndef _WIN32
  45.         #define _WIN32
  46.     #endif
  47. #endif // #if defined(WIN32) || defined(_WIN32)
  48.  
  49.  
  50. #define MACSTART do {
  51. #define MACEND } while (0)
  52.  
  53. #if defined(_WINDOWS) || defined(WIN32)
  54.     #ifndef _INC_WINDOWS
  55.         #ifndef WIN32_EXTRA_LEAN
  56.             #define WIN32_EXTRA_LEAN
  57.         #endif
  58.         #ifndef WIN32_LEAN_AND_MEAN
  59.             #define WIN32_LEAN_AND_MEAN
  60.         #endif
  61.         #include <windows.h>
  62.         #include <wtypes.h>
  63.     #endif
  64.     #ifndef _WINBASE_
  65.         #include <winbase.h>
  66.     #endif
  67.     #include <winerror.h>
  68. #endif
  69.  
  70. // Macro: GXRELEASE
  71. //    Safe release for COM objects
  72. // ***this code should never change - there is stuff that relies on the pointer being
  73. //    set to NULL after being released
  74. #ifndef GXRELEASE
  75.     #define GXRELEASE(_p) MACSTART if ((_p) != NULL) {(_p)->Release(); (_p) = NULL;} MACEND
  76. #endif
  77. #ifndef CHECK_HR
  78.     #define CHECK_HR(__hr) MACSTART if (FAILED(__hr)) goto e_Exit; MACEND
  79. #endif
  80. #ifndef CHECK_MEM
  81.     #define CHECK_MEM(__p) MACSTART if ((__p) == NULL) { hr = E_OUTOFMEMORY; goto e_Exit; } MACEND
  82. #endif
  83.  
  84. #ifndef MAKE_USERERROR
  85.     #define MAKE_USERERROR(code)    MAKE_HRESULT(1,FACILITY_ITF,code)
  86. #endif
  87. #ifndef E_NOTINITIALIZED
  88.     #define E_NOTINITIALIZED        MAKE_USERERROR(0xFFFC)
  89. #endif
  90. #ifndef E_ALREADYINITIALIZED
  91.     #define E_ALREADYINITIALIZED    MAKE_USERERROR(0xFFFB)
  92. #endif
  93. #ifndef E_NOTFOUND
  94.     #define E_NOTFOUND              MAKE_USERERROR(0xFFFA)
  95. #endif
  96. #ifndef E_INSUFFICIENTDATA
  97.     #define E_INSUFFICIENTDATA      MAKE_USERERROR(0xFFF9)
  98. #endif
  99.  
  100. //
  101. // DEBUG STUFF
  102. //
  103.  
  104. #ifdef _DEBUG
  105.     #include <stdio.h>
  106.     #include <crtdbg.h>
  107.     inline void __cdecl
  108.         _GXTrace(const char *szFmt, ...)
  109.     {
  110.         char szMsgBuf[1024];
  111.         va_list alist;
  112.         va_start( alist, szFmt );
  113.         _vsnprintf(szMsgBuf, 1024 - 1, szFmt, alist );
  114.     #if defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
  115.         OutputDebugString(szMsgBuf);
  116.     #endif // #if defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
  117.         fprintf(stderr, "%s", szMsgBuf);
  118.         fflush(stderr);
  119.     }
  120.  
  121.     #define GXASSERT(exp)       ((void) 0)
  122.     #define GXASSERT(exp)       D3DXASSERT(exp)
  123.     #define GXVERIFY(exp)       GXASSERT(exp)
  124.     #define GXDEBUG_ONLY(exp)   (exp)
  125.     #define GXTRACE             ::_GXTrace
  126. #else // #ifdef _DEBUG
  127.     inline void __cdecl _GXTrace(const char *szFmt, ...) {}
  128.     #define GXASSERT(exp)       ((void) 0)
  129.     #define GXVERIFY(exp)       ((void) (exp))
  130.     #define GXDEBUG_ONLY(exp)   ((void) 0)
  131.     #define GXTRACE             1 ? (void) 0 : ::_GXTrace
  132. #endif // #else // #ifdef _DEBUG
  133. #endif
  134.  
  135.  
  136. #endif // #ifndef __GXTESTS_H
  137.